import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { View, StatusBar, StyleSheet } from 'react-native'
import { STATUSBAR_HEIGHT } from 'src/utils/ScreenUtil'

export default class CustomStatusBar extends PureComponent {
  static propTypes = {
    barStyle: PropTypes.string,
    headerBg: PropTypes.string
  }

  static defaultProps = {
    headerBg: '#ffffff',
    barStyle: 'dark-content'
  }

  render () {
    const { barStyle, headerBg } = this.props
    return (
      <View>
        <StatusBar
          animated={false}
          hidden={false}
          backgroundColor={'transparent'}
          barStyle={barStyle}
          translucent={true}
          networkActivityIndicatorVisible={false}
        />
        <View style={[styles.container, headerBg && { backgroundColor: headerBg }]} />
      </View>
    )
  }
}
const styles = StyleSheet.create({
  container: {
    width: '100%',
    height: STATUSBAR_HEIGHT
  }
})
